//
//  QWImagePickerControllerViewController.h
//  OntheRoadV4
//
//  Created by hz on 7/10/13.
//  Copyright (c) 2013 EricHuang. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@class AVCamCaptureManager, AVCamPreviewView, AVCaptureVideoPreviewLayer;

@protocol QWImagePickerControllerDelegate <NSObject>

- (void)didFinishTakeAImage:(NSDictionary *)userInfo;
- (void)didCancelCameraAnimated:(BOOL)animated;

@end

@interface QWImagePickerControllerViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate, CLLocationManagerDelegate> {
}

#pragma mark AVCamCaptureManager
@property (nonatomic,strong) AVCamCaptureManager *captureManager;

@property (nonatomic,strong) IBOutlet UIView *videoPreviewView;
@property (nonatomic,strong) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
@property (nonatomic,strong) IBOutlet UIButton *cameraToggleButton;
@property (nonatomic,strong) IBOutlet UIButton *stillButton;
@property (strong, nonatomic) IBOutlet UIImageView *focusImageView;
@property (strong, nonatomic) IBOutlet UIView *shutterTopHalfView;
@property (strong, nonatomic) IBOutlet UIView *shutterBottomHalfView;

@property (weak, nonatomic) IBOutlet UIView *flashContainerView;
@property (strong, nonatomic) IBOutlet UIButton *cancelBtn;
@property (strong, nonatomic) IBOutlet UIView *toolBarView;
@property (strong, nonatomic) IBOutlet UIButton *toggleFlashBtn;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *focusImgTopSpaceConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *focusImgLeadingSpaceConstraint;

@property (weak, nonatomic) IBOutlet UIImageView *blurOverlayImgView;

// the maximum number of images we can get from library at one time.
@property (nonatomic) NSUInteger maxImageCnt;
@property (nonatomic) CGPoint   currentOffset;
@property (nonatomic) NSInteger direction;

@property (nonatomic, weak) id<QWImagePickerControllerDelegate>delegate;

- (id)initWithSelectedArray:(NSArray *)selectedArray hasSkipBtn:(BOOL)hasSkipBtn;

- (id)initWithCaptureManager:(AVCamCaptureManager *)manager
                previewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;

- (IBAction)cancelBtnPressed:(id)sender;
- (IBAction)captureStillImage:(id)sender;
- (IBAction)toggleCamera:(id)sender;

@end
